const utils = {


  /**
   * 
   * 消息反馈
   *
   */
  toast(title = "加载失败，请重试"){
      return wx.showToast({
        title,
        icon:"none"
      })
  },
  isTabBar(path = ""){
    const navbarList = __wxConfig.tabBar.list.map(({pagePath}) => pagePath.split('.')[0])

    return navbarList.includes(path) ? "switchTab" : "redirectTo"
      
  },
  getDatePicker(number){
    const date = new Date()
    let years = date.getFullYear()
    let month = (date.getMonth()+number)
    if (month > 12) {
      years+=1
      month-=12
    }
    const day = date.getDate()

    return `${years}-${month}-${day}`
  }

}

export default utils

wx.utils = utils